//
//  MineTableViewCell.m
//  ZYZB
//
//  Created by ENERGY on 2018/7/4.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "MineTopTableViewCell.h"

@interface MineTopTableViewCell ()
@property (nonatomic, strong)UILabel * titleLab;//标题
@property (nonatomic, strong)UILabel * contentLab;//内容
@property (nonatomic, strong)UIButton * arrowBtn;//箭头
@end

@implementation MineTopTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        __weak typeof (self)weakSelf = self;
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.contentLab];
        [self.contentView addSubview:self.arrowBtn];
        UIView * lineView = [[UIView alloc] init];
        lineView.backgroundColor = getColor(borderColor);
        [self.contentView addSubview:lineView];
        
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.contentView.mas_top).mas_offset(22/WIDTH_6_SCALE);
            make.bottom.equalTo(weakSelf.contentView.mas_bottom).mas_offset(-22/WIDTH_6_SCALE);
        }];
        [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.arrowBtn.mas_left).mas_offset(-16/WIDTH_6_SCALE);
            make.centerY.equalTo(weakSelf.contentView.mas_centerY);
        }];
        [self.arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
            make.centerY.equalTo(weakSelf.contentView.mas_centerY);
            make.height.mas_offset(12/WIDTH_6_SCALE);
            make.width.mas_offset(7/WIDTH_6_SCALE);
        }];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-18/WIDTH_6_SCALE);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
    }return self;
}
#pragma mark - init
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_12;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _titleLab.text = @"持有中出借";
    }return _titleLab;
}
- (UILabel *)contentLab{
    if (!_contentLab) {
        _contentLab = [[UILabel alloc] init];
        _contentLab.font = DEF_FontSize_14;
        _contentLab.textColor = [UIColor blackColor];
        _contentLab.textAlignment = NSTextAlignmentRight;
        _contentLab.text = @"";
    }return _contentLab;
}
- (UIButton *)arrowBtn{
    if (!_arrowBtn) {
        _arrowBtn = [[UIButton alloc] init];
        [_arrowBtn setImage:[UIImage imageNamed:@"in"] forState:UIControlStateNormal];
    }
    return _arrowBtn;
}
- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.contentLab.text = [NSString stringWithFormat:@"%@", model[@"productPrice"]];
}
@end
